<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  const arr = (s) => {
    const arr = s.split(' ');
    const res = [];
    for (let i = 0; i < arr.length; i++) {
      res.push(arr[i].split('').reverse().join(''));
    }
    return res.join(' ');
  };
  console.log(arr(s = "Let's take LeetCode contest"));
</script>

</html>